/*
The MIT License (MIT)

Copyright (c) 2014 Bert Wierenga

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software 
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#pragma once

#include <dxgi.h>
#include <d3d11.h>
#include "hhdGfxTypes.h"

namespace hhd
{
	inline DXGI_FORMAT Texture2DFormatD3D11(GfxTexture2DFormat in_format)
	{
		switch(in_format)
		{
		case T2DF_R8G8B8A8_INT			: return DXGI_FORMAT_R8G8B8A8_SINT;
		case T2DF_R8G8B8A8_UINT			: return DXGI_FORMAT_R8G8B8A8_UINT;
		case T2DF_R8G8B8A8				: return DXGI_FORMAT_R8G8B8A8_UNORM;

		case T2DF_R16G16B16A16_INT		: return DXGI_FORMAT_R16G16B16A16_SINT;
		case T2DF_R16G16B16A16_UINT		: return DXGI_FORMAT_R16G16B16A16_UINT;
		case T2DF_R16G16B16A16			: return DXGI_FORMAT_R16G16B16A16_UNORM;

		case T2DF_R16					: return DXGI_FORMAT_R16_UNORM;
		case T2DF_R24					: return DXGI_FORMAT_R24_UNORM_X8_TYPELESS;
		case T2DF_R24G8					: return DXGI_FORMAT_R24G8_TYPELESS;
		case T2DF_R32					: return DXGI_FORMAT_R32_TYPELESS;
		case T2DF_R32G8					: return DXGI_FORMAT_R32G8X24_TYPELESS;

		case T2DF_D16					: return DXGI_FORMAT_D16_UNORM;
		case T2DF_D24					: return DXGI_FORMAT_D24_UNORM_S8_UINT;
		case T2DF_D24S8					: return DXGI_FORMAT_D24_UNORM_S8_UINT;
		case T2DF_D32					: return DXGI_FORMAT_D32_FLOAT;
		case T2DF_D32S8					: return DXGI_FORMAT_D32_FLOAT_S8X24_UINT;
		}

		HHD_ASSERT(false);
		return DXGI_FORMAT_R8G8B8A8_UNORM;
	}

}